<?php
class fallas extends Controller {

    var $url="datacenter/fallas/";

    function fallas(){
        parent::Controller();
        $this->load->library("rapyd");
	//$this->datasis->modulo_id('20D',1);
    }
    
    function index(){
        redirect($this->url.'filteredgrid');
    }
    
    function filteredgrid(){
        $this->rapyd->load('datafilter','datagrid');
        
        $atts = array(
                'width'      => '640',
                'height'     => '480',
                'scrollbars' => 'yes',
                'status'     => 'yes',
                'resizable'  => 'yes',
                'screenx'    => '0',
                'screeny'    => '0'
              );
        
        $filter = new DataFilter('', 'pedidos');
        $filter->db->group_by('numero');

        $filter->numero = new inputField('Numero','numero');
        $filter->numero->size      =17;
        $filter->numero->maxlength =15;
        
        $filter->fecha = new dateonlyField("Fecha", "fecha");
        $filter->fecha->clause  ="where";
        $filter->fecha->operator="=";
        
        $uri = anchor_popup("reportes/ver/FPEDIDOG/<#numero#>"    ,'<#numero#>',$atts);
        $uri2= anchor_popup("reportes/ver/GPEDIDOG/<#numero#>"    ,'<#numero#>',$atts);
        $uri3= anchor_popup("reportes/ver/RPEDIDOG/<#numero#>"    ,'<#numero#>',$atts);
        $uri4= anchor("datacenter/pedidof/filteredgrid/<#numero#>",'<#numero#>');
        $uri5= anchor("datacenter/pedidof/creapedidof/<#numero#>",'<#numero#>');
        
        $grid = new DataGrid('');

        $grid->column_orderby('N&uacute;mero'     ,$uri4                                          ,"numero"   ,'align="center"');
        $grid->column_orderby('Fecha'             ,"<dbdate_to_human><#fecha#></dbdate_tohuman>"  ,"fecha"    ,'align="center"');
        $grid->column_orderby('Fallas X Farmacias',$uri                                           ,"numero"   ,'align="center"');
        $grid->column_orderby('Fallas X Pro y Far',$uri2                                          ,"numero"   ,'align="center"');
        $grid->column_orderby('Resumen de Fallas' ,$uri3                                          ,"numero"   ,'align="center"');
        $grid->column_orderby('Crear Pedido'      ,$uri5                                          ,"numero"   ,'align="center"');

        $grid->build();

        $data['filtro']  = $filter->output;
        $data['content'] = $grid->output;
        $data['head']    = $this->rapyd->get_head().script('jquery.js');
        $data['title']   = heading('Fallas Guardadas');
        $this->load->view('view_ventanas', $data);

    }
}
?>